package slu.appli.tools.parser.stringparser.impl.model;

import java.util.ArrayList;
import java.util.List;

import slu.appli.tools.parser.stringparser.interfaces.model.GroupInterface;

public class BasicGroup  implements GroupInterface {
	private int occurs = 1;
	private List<Object> childs = null;
	
	public BasicGroup(int occurs) {
		super();
		this.occurs = occurs;
	}
	
	public BasicGroup() {
		super();
	}

	/* (non-Javadoc)
	 * @see slu.appli.tools.parser.stringparser.impl.treemodel.GroupInterface#addChild(java.lang.Object)
	 */
	public void addChild(Object item) {
		if (this.childs == null) this.childs = new ArrayList<Object>();
		this.childs.add(item);
	}
	
	/* (non-Javadoc)
	 * @see slu.appli.tools.parser.stringparser.impl.treemodel.GroupInterface#getChildCount()
	 */
	public int getChildCount() {
		if (this.childs == null) return 0;
		else return this.childs.size();
	}
	
	/* (non-Javadoc)
	 * @see slu.appli.tools.parser.stringparser.impl.treemodel.GroupInterface#getChildAt(int)
	 */
	public Object getChildAt(int pos) {
		return this.childs.get(pos);
	}

	/* (non-Javadoc)
	 * @see slu.appli.tools.parser.stringparser.impl.treemodel.GroupInterface#getOccurs()
	 */
	public int getOccurs() {
		return occurs;
	}

	/* (non-Javadoc)
	 * @see slu.appli.tools.parser.stringparser.impl.treemodel.GroupInterface#setOccurs(int)
	 */
	public void setOccurs(int occurs) {
		this.occurs = occurs;
	}
}
